<?php
/**
 * @filename:					DistrictAction.class.php
 * @desc:						墓地园、区、排模块
 *
 * @author: 					张召
 * @copyright:					winzzhao@sina.com
 * @date:						2011-04-18
 */


class DistrictAction extends CommonAction
{
   
   /* function _initialize() {
        $type = D('graveyard_type');
        $typename = $type->select();
        $state = D('graveyard_state');
        $statename = $state->select();
        $garden = D('garden');
        $gardenname = $garden->select();

        $district = D('district');
        $districtname = $district->select();
        $group = D('graveyard_group');
        $groupname = $group->select();

        $this->assign('districtname',$districtname);
        $this->assign('groupname',$groupname);
        $this->assign('gardenname',$gardenname);
        $this->assign('typename',$typename);
        $this->assign('statename',$statename);
        
    }*/



    /**
    * 查所在园看区的信息
    */
    public function index()
    {
		//获取园名称  id
		$id = $_REQUEST[id];
		$district = D ('district');			
		$list = $district->where("garden_id = '$id'")->select();
		//dump($list);die;

    	$crumb_info = array(
			array('uri' => "__URL__/index/id/$id",'title' => L('district_manage'), 'sort' => C('CRUMB_LAST')),
		);
		$this->_mergeCrumbInfo($crumb_info);
		$this->_action_link = array(
			array('uri' => "__URL__/add/id/$id", 'title' => L('add_district')),
		);
		$this->assign('crumb_info', $this->_crumb_info);
		$this->assign('action_link', $this->_action_link);

		
//		$list=$district->query("select d.id,d.name as name1 ,d.status,g.name as name2 from GMS_district d join GMS_garden g on d.garden_id = g.id ");
		$this->assign('list',$list);
		$this->display ();
    }


    /**
    * 在所属园内添加区
    */
    public function add()
    {
    	//获取所在园添加区时的garden_id
    	$id = $_REQUEST[id];
    	  
    	$crumb_info = array(
			array('uri' => "__URL__/index/id/$id", 'title' => L('district_manage'), 'sort' => C('CRUMB_DEFAULT')),
			array('uri' => "__URL__/add/id/$id", 'title' => L('add_district'), 'sort' => C('CRUMB_LAST')),
		);
		$this->_mergeCrumbInfo($crumb_info);
		$this->_action_link = array(
			array('uri' => "__URL__/index/id/$id", 'title' => L('list_district')),
			);
		$this->assign('crumb_info', $this->_crumb_info);
		$this->assign('action_link', $this->_action_link);
		$this->assign('id',$id);
		parent::add();

    }


    /**
    * 修改或完善所设置区的详细信息
    */
    public function edit()
    {
	    	//获取所在园添加区时的garden_id
    	//$id = $_REQUEST[id];
    	  
    	$crumb_info = array(
			array('uri' => "__URL__/index", 'title' => L('district_manage'), 'sort' => C('CRUMB_DEFAULT')),
			array('uri' => "__URL__/edit/id/" . $_REQUEST['id'], 'title' => L('edit_district'), 'sort' => C('CRUMB_LAST')),
		);
		$this->_mergeCrumbInfo($crumb_info);
		$this->_action_link = array(
			array('uri' => "__URL__/index", 'title' => L('list_district')),
			);
		$this->assign('crumb_info', $this->_crumb_info);
		$this->assign('action_link', $this->_action_link);
	   parent::edit();
    }
  

    /**
    * 删除某个片内某个区
    */
    public function delete()
    {
       parent::delete();
    }

}

?>